﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" AutoEventWireup="true"
    CodeFile="ViewLoginHistory.aspx.cs" Inherits="Admin_user_ViewLoginHistory" Title="Admin - View User Log In History" %>

<%@ Register Src="../../controls/usrDate.ascx" TagName="usrDate" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="contents">
    <table width="100%" cellpadding="3" cellspacing="0" border="0">
        <tr>
            <td colspan="2">
                <h1>User Log In/Out History</h1><asp:Label ID="Label1" runat="server" Visible="false" Width="10px"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 30%"; valign="top">
                Login Date
            </td>
            <td>
                <asp:TextBox ID="txtDateTime" runat="server"></asp:TextBox>
                (yyyymmdd)<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                    ValidationExpression="\d{8}" ControlToValidate="txtDateTime" ErrorMessage="8 digits number format only."></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td valign="top">
                User ID
            </td>
            <td>
                <asp:TextBox ID="txtUserId" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:Button ID="btnShowResult" runat="server" OnClick="btnShowResult_Click" Text="Submit" />
            </td>
        </tr>
         <tr>
            <td colspan="2">
                <asp:GridView ID="grvLoginHistory" runat="server" AutoGenerateColumns="False" Cellspacing="3" CellPadding="3" Width="100%"
                    DataKeyNames="CEID,LoginHisId" DataSourceID="sqlDbUserLoginHistory" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                    GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCreated="grvLoginHistory_RowCreated"
                    OnRowDataBound="grvLoginHistory_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="LoginHisId" HeaderText="LoginHisId" InsertVisible="False"
                            ReadOnly="True" SortExpression="LoginHisId" />
                        <asp:BoundField DataField="CEID" HeaderText="CEID" SortExpression="CEID" />
                        <asp:BoundField DataField="UsrTypeId" HeaderText="UsrTypeId" SortExpression="UsrTypeId" />
                        <asp:BoundField DataField="StartTime" HeaderText="StartTime" SortExpression="StartTime" />
                        <asp:BoundField DataField="EndTime" HeaderText="EndTime" SortExpression="EndTime" />
                        <asp:CheckBoxField DataField="IsExpired" HeaderText="IsExpired" SortExpression="IsExpired" />
                        <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
                        <asp:HyperLinkField HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
                            HeaderText="Information" Text="View" Target="_blank" DataNavigateUrlFormatString="ViewLoginInformation.aspx?CEID={0}&LogHisId={1}"
                            DataNavigateUrlFields="CEID,LoginHisId"></asp:HyperLinkField>
                    </Columns>
                    <FooterStyle />
                    <PagerStyle />
                    <SelectedRowStyle />
                    <HeaderStyle CssClass="admin_gridheader" />
                    <EditRowStyle />
                    <AlternatingRowStyle CssClass="admin_gridodd" />
                    <RowStyle CssClass="admin_grideven" />
                </asp:GridView>
                <asp:SqlDataSource ID="sqlDbUserLoginHistory" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                    SelectCommand="sprocUserLoginHistorySelectItemList" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:QueryStringParameter DefaultValue="0" Name="CEID" QueryStringField="CEID" Type="Int64" />
                        <asp:QueryStringParameter ConvertEmptyStringToNull="False" Type="String" DefaultValue=""
                            Name="StartTime" QueryStringField="dt" Size="8" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
</div>
</asp:Content>
